<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>所有留言</title>
	<link type="text/css" rel="stylesheet" href="../css/style.css"/>
	<script type="text/javascript" src="../js/jquery-3.4.1.js"></script>
	<script type="text/javascript" src="../js/javascript.js"></script>
	<script type="text/javascript" src="../js/vue.min.js"></script>
	<script type="text/javascript" src="../js/httpVueLoader.js"></script>
	<script type="text/javascript" src="../js/index.js"></script>
	<script type="text/javascript" src="../js/node_modules/axios/dist/axios.js"></script>
</head>
<body>
<div id="messageListApp">
	<top-manage></top-manage>
	<div id="middle">
		<div id="position">
			您现在的位置是&nbsp;&gt;&nbsp;<a href="index-manage.html">管理后台</a>&nbsp;&gt;&nbsp;留言管理
		</div>
		<message-manage></message-manage>
		<div id="main">
			<table>
				<tr class="firstLine">
					<td style="width:50px;">留言ID</td>
					<td style="width:400px;">留言内容</td>
					<td style="width:80px;">留言用户</td>
					<td style="width:150px;">留言商品</td>
					<td style="width:80px;">留言状态</td>
					<td>更多...</td>
				</tr>
				<c:if test="${remainRow!=10}">
					<c:forEach var="message" items="${messagelist}">
						<tr>
							<td>${message.message_id}</td>
							<td>${message.message_contents}</td>
							<td>
								<c:forEach var="messageuser" items="${messageuserlist}">
									<c:if test="${messageuser.id==message.message_userid}">${messageuser.username}</c:if>
								</c:forEach>
							</td>
							<td>
								<c:forEach var="messageproduct" items="${messageproductlist}">
									<c:if test="${messageproduct.product_id==message.message_productid}">${messageproduct.product_name}</c:if>
								</c:forEach>
							</td>
							<%-- 					<td>${message.reply_contents}</td> --%>
							<!-- 					<td> -->
							<%-- 						<c:forEach var="messageuser" items="${messageuserlist}"> --%>
							<%-- 							<c:if test="${messageuser.id==message.reply_userid}">${messageuser.username}</c:if> --%>
							<%-- 						</c:forEach> --%>
							<!-- 					</td> -->
							<c:if test="${message.reply_contents.equals('')}">
								<td>待回复</td>
								<td><a href="../MessageServlet?action=replymessage&message_id=${message.message_id}">去回复留言</a></td>
							</c:if>
							<c:if test="${!message.reply_contents.equals('')}">
								<td>已回复</td>
								<td><a href="../MessageServlet?action=replymessage&message_id=${message.message_id}">查看留言</a></td>
							</c:if>
						</tr>
					</c:forEach>
					<c:forEach begin="1" end="${remainRow}" step="1">
						<tr class="lastLine">
							<td colspan="8"></td>
						</tr>
					</c:forEach>
				</c:if>
				<c:if test="${remainRow==10}">
					<tr class="lastLine">
						<td colspan="6" style="height:437px;">对不起！该页没有留言信息</td>
					</tr>
				</c:if>
				<tr class="lastLine">
					<td colspan="4"></td>
					<td colspan="2" align="right">
						<form action="../MessageServlet" method="post" onsubmit="return checkPageNumStatus()">
							<input type="hidden" name="action" value="allmessage"/>
							<input type="submit" value="-" class="modifyButton" name="jumpminus"/>
							<input type="text" size="4" value="${pageNum}" name="pageNum"/>
							<input type="submit" value="+" class="modifyButton" name="jumpplus"/>
							<input type="submit" value="跳转" name="jump" class="button"/>
						</form>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<bottom></bottom>
</div>
<script type="text/javascript">
	Vue.use(httpVueLoader);
	const app = new Vue({
		el: "#messageListApp",
		components: {
			'top-manage': 'url:../common/top-manage.vue',
			'bottom': 'url:../common/bottom.vue',
			'message-manage': 'url:../common/message-manage.vue',
		},
	});
</script>

</body>
</html>